package com.dn.designpatterns.adapter;

/**
 * @program: designpatterns
 * @description: 对象适配器
 * @author: DN
 * @create: 2021-04-10 14:05
 **/
public class ObjectAdapter implements Target{

    private Adaptee adaptee;

    public ObjectAdapter(Adaptee adaptee) {
        this.adaptee = adaptee;
    }

    @Override
    public void request() {
        adaptee.specificRequest();
    }
}

// 客户端代码
class ObjectAdapterTest {
    public static void main(String[] args) {
        System.out.println("对象适配器模式测试:");
        Adaptee adaptee = new Adaptee();
        Target target = new ObjectAdapter(adaptee);
        target.request();
    }
}